package com.ruoyi.stu.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ruoyi.system.domain.SysStudentCourse;
import com.ruoyi.stu.domain.StuStudentUnit;

/**
 * 学生-单元表
 * 
 * @author Jason
 */
public interface StuStudentUnitMapper
{
	
	public List<StuStudentUnit> list(
			@Param("studentId")Long studentId,
			@Param("courseId")Long courseId);
	
	public StuStudentUnit selectByStudentIdAndUnitId(@Param("studentId")Long studentId, @Param("unitId")Long unitId);
	
    /**
     * @return 结果
     */
    public int deleteByStudentId(@Param("studentId")Long studentId);

    /**
     */
    public int countByStudentId(@Param("studentId")Long studentId);

    /**
     */
    public int countByStudentIdAndCourseId(
			@Param("studentId")Long studentId,
			@Param("courseId")Long courseId);

    /**
     * 批量新增
     * @return 结果
     */
    public int insertBatch(@Param("list")List<SysStudentCourse> listEntity);

    /**
     * 批量新增（通过课程ID）
     * @return 结果
     */
    public int insertBatchByCourseId(
			@Param("studentId")Long studentId,
			@Param("courseId")Long courseId);
    
    /**
     * 删除不在学员-课程内的学员-单元
     * @param studentId
     * @param courseId
     */
    public void deleteNotInCourse(@Param("studentId")Long studentId);

    /**
     * 更新状态
     */
    public int updateStateByStudentIdAndUnitId(
			@Param("studentId")Long studentId,
			@Param("unitId")Long unitId,
			@Param("fieldName")String fieldName,
			@Param("fieldValue")Integer fieldValue);
}